message("                                                               ")
message("       ====   ||      ||    ====        ==========    =====    ")
message("     ||       ||      ||   ||     =         //      //     =   ")
message("    ||        || ==== ||   ||     =        //      //     =    ")
message("     ||       ||      ||   ||====         //      //=====      ")
message("      =====   ||      ||   ||            //      //            ")
message("                           ||           //      //             ")

#################     最低版本     ###################
cmake_minimum_required(VERSION 3.10)

#################     项目名称     ###################
project(chp_thread_pool)

set(CMAKE_C_STANDARD 99)#C99 # lvgl officially support C99 and above
set(CMAKE_CXX_STANDARD 11)#C11
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(root_dir ${PROJECT_BINARY_DIR}/..)
#set(root_dir .)

#################     头文件     ###################
include_directories(${root_dir}/inc)

#################     源文件     ###################
aux_source_directory(${root_dir}/src      MAIN_SRC)
aux_source_directory(${root_dir}/old/v1   OLD_V_1)
aux_source_directory(${root_dir}/old/v2   OLD_V_2)
aux_source_directory(${root_dir}/old/v3   OLD_V_3)
aux_source_directory(${root_dir}/old/v4   OLD_V_4)
aux_source_directory(${root_dir}/old/v5   OLD_V_5)
#add_subdirectory(${root_dir}/src/sub)

#################   生成动静态库   #################
#add_library(bb SHARED ${MAIN_SRC3}) 
#add_library(lib_name STATIC src) 

#给库取名,不用set_target_properties时,默认为add_library时指定的名字
#set_target_properties(bb PROPERTIES OUTPUT_NAME "BB")

##############   设置自己生成的库路径   ##############
set(LIBRARY_OUTPUT_PATH ${root_dir}/lib)

##############  设置可执行文件存放目录   #############
set(EXECUTABLE_OUTPUT_PATH ${root_dir}/bin)

##################   发现依赖库   ##################
#find_library(MY_LIB BB ${LIBRARY_OUTPUT_PATH})

###################   编译选项   ###################
add_compile_options(-O2)

#################   生成可执行文件   ################
add_executable(t1    ./test/test.c   ${MAIN_SRC})
add_executable(t2    ./test/test2.c  ${MAIN_SRC})
add_executable(v1_1  ./test/test.c   ${OLD_V_1})
add_executable(v1_2  ./test/test2.c  ${OLD_V_1})
add_executable(v2_1  ./test/test.c   ${OLD_V_2})
add_executable(v2_2  ./test/test2.c  ${OLD_V_2})
add_executable(v3_1  ./test/test.c   ${OLD_V_3})
add_executable(v3_2  ./test/test2.c  ${OLD_V_3})
add_executable(v4_1  ./test/test.c   ${OLD_V_4})
add_executable(v4_2  ./test/test2.c  ${OLD_V_4})
add_executable(v5_1  ./test/test.c   ${OLD_V_5})
add_executable(v5_2  ./test/test2.c  ${OLD_V_5})
add_executable(hm    ./test/hm.cpp  )
add_executable(hm2   ./test/hm2.cpp )
####################   链接库   ###################
target_link_libraries(t1 pthread)
target_link_libraries(t2 pthread)
target_link_libraries(v1_1 pthread)
target_link_libraries(v1_2 pthread)
target_link_libraries(v2_1 pthread)
target_link_libraries(v2_2 pthread)
target_link_libraries(v3_1 pthread)
target_link_libraries(v3_2 pthread)
target_link_libraries(v4_1 pthread)
target_link_libraries(v4_2 pthread)
target_link_libraries(v5_1 pthread)
target_link_libraries(v5_2 pthread)
target_link_libraries(hm   pthread)
target_link_libraries(hm2  pthread)
message(${root_dir})
message(${MAIN_SRC})


###########################################
# aux_source_directory(dir var) 他的作用是把dir目录中的所有源文件都储存在var变量中
# PROJECT_BINARY_DIR是cmake系统变量，意思是执行cmake命令的目录，我们计划在build目录下执行cmake命令，所以这个变量也就等同于build目录
# message(${PROJECT_SOURCE_DIR}) 打印变量
#--------------------------------------------------------------------
#add_library(lib_name STATIC/SHARED src) 
# 函数作用：生成库。
# 参数lib_name：是要生成的库名称，
# 参数STATIC/SHARED：指定生成静态库或动态库，
# 参数src：指明库的生成所需要的源文件
###########################################

